#include "ModuleManager/ModuleManager.h"
#include "ModuleIOPortManager/ModuleIOPortManager.h"
#include <thread>

ModuleManager& ModuleManager::GetInstance() {
    static ModuleManager moduleManager;
    return moduleManager;
}
APP_ERROR ModuleManager::Start(const std::vector<std::shared_ptr<Module>> &modules) {
    modules_ = modules;
    for (auto &m : modules_) {
        m->Start(true);
    }
    return APP_ERR_OK;
}
APP_ERROR ModuleManager::Stop() {
    ModuleIOPortManager::GetInstance().Clear();
    for (auto &m : modules_) {
        m->Stop();
    }
    return APP_ERR_OK;
}
